const http = uni.$u.http;

// 登陆接口
export const login = (data, config = {}) => http.get('/auth/wxSmallAppLogin', {params: data}, config);

/**
 * 首页接口
 */
// 获取banner
export const getBannerList = (data, config = {}) => http.get('/banner/getBannerList', {params: data}, config);

// 获取活动分类
export const getActivityCategoryList = (data, config = {}) => http.get('/activity/getActivityCategoryList', {params: data}, config);

// 获取活动列表
export const getActivityNormalPage = (data, config = {}) => http.get('/activity/getActivityNormalPage', {params: data}, config);

// 获取派对列表
export const getActivityPartPage = (data, config = {}) => http.get('/activity/getActivityPartPage', {params: data}, config);

// 获取城市列表
export const getCityViewVoList = (data, config = {}) => http.get('/area/getCityViewVoList', {params: data}, config);

// 根据经纬度获取行政信息
export const getAppLocationVo = (data, config = {}) => http.get('/area/getAppLocationVo', {params: data}, config);

/**
 * 活动详情
 */
// 获取活动详情
export const getActivityDetail = (data, config = {}) => http.get('/activity/getActivityDetail', {params: data}, config);

// 活动报名
export const userSignUpActivity = (data, config = {}) => http.post('/activity/userSignUpActivity', data, config);
// 发起人取消活动
export const cancelActivity = (data, config = {}) => http.post('/activity/cancelActivity', data, config);

// 报名人取消活动报名
export const userCancelSignUpActivity = (data, config = {}) => http.post('/activity/userCancelSignUpActivity', data, config);
export const commitUserActivitySignUpFee = (data, config = {}) => http.post('/activity/commitUserActivitySignUpFee', data, config);
/**
 * 发布活动
 */
// 创建活动
export const createActivity = (data, config = {}) => http.post('/activity/createActivity', data, config);
// 更新活动
export const updateActivity = (data, config = {}) => http.post('/activity/updateActivity', data, config);
// 获取上传文件的加密信息
export const createOssUploadToken = (data, config = {}) => http.post('/file/oss/createOssUploadTokenV2', {}, config);

/**
 * 编辑个人信息
 */
// 获取个人信息
export const getUserInfo = (data, config = {}) => http.get('user/getUserInfo', {params: data}, config);

// 更新个人信息
export const updateUserInfo = (data, config = {}) => http.post('/user/updateUserInfo', data, config);

/**
 * 个人主页
 */
// 获取个人主页信息
export const getUserInfoByUserId = (data, config = {}) => http.get('/user/getUserInfoByUserId', {params: data}, config);

// 我玩过的
export const getUserSignupActivityPage = (data, config = {}) => http.get('/activity/getUserSignupActivityPage', {params: data}, config);
// 我创建的
export const getUserCreateActivityPage = (data, config = {}) => http.get('/activity/getUserCreateActivityPage', {params: data}, config);
// 个人主页 根据指定用户id 读取我关联的活动
export const getUserAssociationActivityPage = (data, config = {}) => http.get('/activity/getUserAssociationActivityPage', {params: data}, config);

/**
 * 个人账户
 */
// 账户数据
export const getUserAccount = (data, config = {}) => http.get('/account/getUserAccount', {params: data}, config);

// 提现
export const commitWithdrawAudit = (data, config = {}) => http.post('/account/commitWithdrawAudit', data, config);

// 账户明细
export const getUserAccountInOutPage = (data, config = {}) => http.get('/account/getUserAccountInOutPage', {params: data}, config);

/**
 * 图片上传
 */
// 单张图片上传
export const uploadFile2Oss = (data, config = {}) => http.get('/file/oss/uploadFile2Oss', {params: data}, config);

// 多张图片上传
export const uploadFileList2Oss = (data, config = {}) => http.get('/file/oss/uploadFileList2Oss', {params: data}, config);

/**
 * 用户认证
 */
// 用户认证
export const saveUpdateUserAuthentication = (data, config = {}) => http.post('/user/saveUpdateUserAuthentication',  data, config);
// 获取用户认证信息
export const getUserAuthentication = (data, config = {}) => http.post('/user/getUserAuthentication',  data, config);

// 创建会员订单并返回支付信息
export const createVipOrderPay = (data, config = {}) => http.post('/vip/createVipOrderPay',  data, config);
// 获取用户会员信息
export const getUserVipInfo = (data, config = {}) => http.get('/vip/getUserVipInfo', { params: data }, config);

/**
 * 场地接口
 */
// 场地列表
export const getMerchantPage = (data, config = {}) => http.get('/merchant/getMerchantPage', { params: data }, config);

// 提交用户的申请的场地信息
export const commitMerchantApply = (data, config = {}) => http.post('/merchant/commitMerchantApply', data, config);

// 场地详情页
export const getMerchantDetail = (data, config = {}) => http.get('/merchant/getMerchantDetail', { params: data }, config);

// 获取当前用户场地信息 
export const getMerchantInfo = (data, config = {}) => http.get('/merchant/getMerchantInfo', { params: data }, config);

// 更新
export const updateMerchant = (data, config = {}) => http.post('/merchant/updateMerchant', data, config);

// 获取场地下面的活动列表
export const getMerchantActivityPage = (data, config = {}) => http.get('/activity/getMerchantActivityPage', { params: data }, config);
// getUserActivityIngList
export const getUserActivityIngList = (data, config = {}) => http.get('/activity/getUserActivityIngList', { params: data }, config);
/// 读取指定商家下的产品列表 /dev-api/app/product/getProductList
export const getProductList = (data, config = {}) => http.get('/product/getProductList', { params: data }, config);
/// 读取指定商家下的产品列表 dev-api/app/product/getProductById
export const getProductById = (data, config = {}) => http.get('/product/getProductById', { params: data }, config);

// 发布活动的场地
export const getRecMerchantListByCategory = (data, config = {}) => http.get('/merchant/getRecMerchantListByCategory', { params: data }, config);

// 二维码
export const getAssociationList = (data, config = {}) => http.get('/association/getAssociationList', { params: data }, config);


// 发布动态
export const commitDynamic = (data, config = {}) => http.post('/dynamics/commitDynamic', data, config);
// 获取标签
export const getDynamicsTagList = (data, config = {}) => http.get('/dynamics/getDynamicsTagList', { params: data }, config);

// 用户评论动态
export const commitDynamicComment = (data, config = {}) => http.post('/dynamics/commitDynamicComment', data, config);

// 点赞/取消点赞动态
export const commitDynamicGood = (data, config = {}) => http.post('/dynamics/commitDynamicGood', data, config);

// 用户删除动态
export const deleteDynamic = (data, config = {}) => http.post('/dynamics/deleteDynamic', data, config);

// 用户删除评论
export const deleteDynamicComment = (data, config = {}) => http.post('/dynamics/deleteDynamicComment', data, config);

// 获取动态分页列表
export const getDynamicsPage = (data, config = {}) => http.get('/dynamics/getDynamicsPage', { params: data }, config);

// 获取推荐动态分页列表
export const getUserRecDynamicsPage = (data, config = {}) => http.get('/dynamics/getUserRecDynamicsPage', { params: data }, config);

// 获取标签
export const getUserDynamicsPage = (data, config = {}) => http.get('/dynamics/getUserDynamicsPage', { params: data }, config);

// 获取动态详情
export const getDynamicsDetail = (data, config = {}) => http.get('/dynamics/getDynamicsDetail', { params: data }, config);


/** 消息模块 */
// 用户发送DiDi申请
export const commitUserDiDi = (data, config = {}) => http.post('/message/commitUserDiDi', data, config);

// 确认用户DIDI通过
export const confirmUserDiDi = (data, config = {}) => http.post('/message/confirmUserDiDi', data, config);

// 获取消息分页列表
export const getMessagePage = (data, config = {}) => http.get('/message/getMessagePage', { params: data }, config);

// 读取消息分类列表
export const getMessageTypeList = (data, config = {}) => http.get('/message/getMessageTypeList', { params: data }, config);

// 读取未读消息个数
export const getMessageUnReadCount = (data, config = {}) => http.get('/message/getMessageUnReadCount', { params: data }, config);

// 获取DIDI申请分页列表
export const getUserDiDiVoPage = (data, config = {}) => http.get('/message/getUserDiDiVoPage', { params: data }, config);

// 不同意用户DIDI申请
export const refuseUserDiDi = (data, config = {}) => http.post('/message/refuseUserDiDi', data, config);

// 关注/取消关注
export const commitUserAttention = (data, config = {}) => {
	const { params } = config;
	return http.post(`/user/commitUserAttention?${params || ''}`, data, config);
}

// 获取个人用户关注分页列表
export const getUserAttentionPage = (data, config = {}) => http.get('/user/getUserAttentionPage', { params: data }, config);

// 获取个人用户粉丝分页列表
export const getUserFollowPage = (data, config = {}) => http.get('/user/getUserFollowPage', { params: data }, config);


export const getTableData = () => {
  return request({
    url: '/config/area_format_object.json',
    method: 'get',
  })
}
